Repository navigation
Fix the PDF thumbnail example: convert page 1 straight to JPG - #56
Merged
Merged
Conversation
pdf -> extract is now the AI data-extraction converter: it returns JSON and has no PageRange, so the example's second step got a JSON file instead of page 1. One pdf -> jpg call with pagerange=1 and imageheight=300 now makes the thumbnail (231x300 for test.pdf), in one conversion instead of two. scaleimage and scaleproportions are dropped: they are not pdf -> jpg parameters and the API ignored them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 6, 2026
Merged
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the direct PDF-to-JPG thumbnail update.
No open issues 🎉
What changed in this PR
Fixes the Java PDF thumbnail example by converting page 1 directly to JPG, avoiding the extract converter that now returns JSON.
Changes:
- Replaces the two-step conversion with one PDF-to-JPG call using
pagerange1 andimageheight300. - Removes unsupported
scaleimageandscaleproportionsparameters. - Updates the example’s comment and removes the extraction documentation link.
| File | Description |
|---|---|
examples/src/main/java/com/convertapi/examples/CreatePdfThumbnail.java |
Converts the first PDF page directly to a JPG thumbnail and updates the documentation comment. |
Review effort: Balanced
This was referenced Nov 9, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The example cut page 1 out of the PDF with the
extractconverter andpagerange1, then converted that page to JPG.pdf -> extractis now the AI data-extraction converter: it returns JSON and has noPageRangeparameter (spec), so the second step gets a JSON file instead of page 1.The Python example makes the same two calls and fails on production like this:
Change
pdf -> jpgcall withpagerange1 andimageheight300 makes the thumbnail: one conversion instead of two. Fortest.pdf(US Letter) it is 231x300.scaleimageandscaleproportionsare dropped. They are notpdf -> jpgparameters (spec) and the API ignores them: the output is byte for byte the same with or without them.Verification
Compiled with
./mvnw -f examples/pom.xml compileagainst convertapi 2.13.1 from Maven Central, then run on OpenJDK 27.0.1 against the production API on 2026-11-06, in a folder holdingfiles/test.pdf(a copy ofexamples/src/main/resources/test.pdf).$TMPDIRis the local temp folder:test.jpgis 231x300 px, 8,858 bytes.Not changed here: the comment in
SplitAndMergePdf.javaalso links https://www.convertapi.com/pdf-to-extract, although that example usessplit.Only the example changes, not the library, so there is no CHANGELOG entry.
The thumbnail examples of the other SDKs are fixed in ConvertAPI/convertapi-library-python#61, ConvertAPI/convertapi-library-php#72, ConvertAPI/convertapi-library-ruby#42, ConvertAPI/convertapi-library-dotnet#82, ConvertAPI/convertapi-library-node#123.
🤖 Generated with Claude Code